package com.ctrl.riveradministrator.mvp.presenter;

import android.util.Log;

import com.ctrl.riveradministrator.base.BaseObserver;
import com.ctrl.riveradministrator.base.BasePresenter;
import com.ctrl.riveradministrator.RaApplication;
import com.ctrl.riveradministrator.mvp.model.Task;
import com.ctrl.riveradministrator.mvp.view.activity.trace.search.TraceSearchView;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class TraceSearchPresenter extends BasePresenter<TraceSearchView> {

    public TraceSearchPresenter(TraceSearchView baseView) {
        super(baseView);
    }

    public void searchTrace(String pageNumb,String pageSize ) {
        Map<String, String> map = new HashMap<>();
        map.put("userId", RaApplication.getUserId());
        map.put("pageNumb", pageNumb);
        map.put("pageSize", pageSize);
        attachView(apiService.patrolHistory(map), new BaseObserver<Task>(getBaseView()) {
            @Override
            public void onSuccess(Task model) {
                Log.d("onSuccess", ":");
            }

            @Override
            public void onSuccess(List<Task> model) {
                getBaseView().onSuccess(model);
            }

            @Override
            public void onFailed(String msg) {
                Log.d("onFailed", ":" + msg);
            }

        });
    }
}
